package com.weiyuwqj.api.model.vo;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * Created by huzj on 2016/10/25.
 */
public class InvestStatVo implements Serializable,Comparable<InvestStatVo>{
    private String investYear;

    private String investMonth;

    private BigDecimal investAmount;

    public String getInvestYear() {
        return investYear;
    }

    public void setInvestYear(String investYear) {
        this.investYear = investYear;
    }

    public String getInvestMonth() {
        return investMonth;
    }

    public void setInvestMonth(String investMonth) {
        if(investMonth.indexOf("0")==0){
            investMonth=investMonth.substring(1);
        }
        this.investMonth = investMonth;
    }

    public BigDecimal getInvestAmount() {
        return investAmount;
    }

    public void setInvestAmount(BigDecimal investAmount) {
        this.investAmount = investAmount;
    }

    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if(obj instanceof InvestStatVo){
            InvestStatVo statVo =(InvestStatVo)obj;
            if(Integer.parseInt(statVo.getInvestMonth())== Integer.parseInt((this.getInvestMonth()))
                    && statVo.getInvestYear().equals(this.getInvestYear()))
                return true;
        }
        return false;
    }

    @Override
    public int compareTo(InvestStatVo investStatVo) {
        if (Integer.parseInt(this.getInvestYear())>Integer.parseInt(investStatVo.getInvestYear())){
            return 1;
        }else if(Integer.parseInt(this.getInvestYear())==Integer.parseInt(investStatVo.getInvestYear())){
            if (Integer.parseInt(this.getInvestMonth())>Integer.parseInt(investStatVo.getInvestMonth())){
                return 1;
            }else {
                return -1;
            }
        }else {
            return -1;
        }

    }
}
